package main

import (
	"git.hortorgames.com/orange/tang"
	"git.hortorgames.com/serverless/htgserver/apiserver"
	"git.hortorgames.com/serverless/htgserver/tags"
)

func main() {
	tags.Register()
	_ = tang.Init()

	//go func() {
	//	_ = storage.GetRedisClient("default").UsingSession(func(sess *redis.Session) error {
	//		err := session.Init(sess, 12345, "aassdd", 1, []byte("1"))
	//		//err = session.AddResp(sess, 12345, 1, []byte("resp1"))
	//		_, err = session.AddReq(sess, 12345, 1, []byte(fmt.Sprintf("req %d", 1)))
	//		//for i := 2; i <= 10; i ++ {
	//		//	_, err = session.AddReq(sess, 12345, i, []byte(fmt.Sprintf("req %d", i)))
	//		//}
	//		return err
	//	})
	//}()
	//
	//go func() {
	//	time.Sleep(time.Second*3)
	//	_ = storage.GetRedisClient("default").UsingSession(func(sess *redis.Session) error {
	//		err := session.AddResp(sess, 12345, 1, []byte(fmt.Sprintf("resp %d", 1)))
	//		return err
	//	})
	//}()

	{
		server := apiserver.NewServer()
		//server.RegisterController(handlers.NewMidVerifyLogin(server, "login"), handlers.NewLogin(server))
		//server.RegisterController(handlers.NewMidVerify(server, "player"), handlers.NewPlayer(server))
		//server.RegisterController(handlers.NewMidVerify(server, "save"), handlers.NewSave(server))
		_ = server.Start()
	}

	//{
	//	server := apiserver2.NewServer()
	//	server.RegisterController(handlers2.NewGame(server))
	//	//_ = server.Start()
	//}

	tang.WaitForStop()
}
